package Demo;

public class Demo04 {
    public static void main(String[] args) {
        // 遍历1~100所有偶数的和，及偶数个数
        //设置变量，累计求和
        int sum = 0;
        //设置变量，统计循环次数
        int count = 0;
        for(int b = 1; b <= 100; b++){
            if(b % 2 == 0){
                sum += b;
                count++;
                System.out.print(b);
            }
        }
        System.out.println();
        System.out.println("求和"+sum);
        System.out.println("偶数个数"+count);

    }
}
